<template>
  <view class="uni-file box cl-second fz-12">
    <text class="mr-5" @tap="previewFile">{{item.name}}</text>
    <text class="icon icon-error cl-main pointer pointer-filter" @tap="deleteFile"></text>
  </view>
</template>

<script>
export default {
  name: "uniFile",

  props: {
    item: {
      type: Object,
      default: {}
    }
  },

  methods: {
    /*
     * 预览文件
     */
    previewFile() {
		uni.navigateTo({
		    url: `/pages/index/filesdetaile?url=${JSON.stringify(this.$props.item)}`,
		});
	},
    /*
     * 删除文件
     */
    deleteFile() {
      this.$emit("delete", this.item);
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
